package com.sayice.gomoku.dao.impl;

import com.sayice.gomoku.dao.AdminDao;
import com.sayice.gomoku.pojo.Admin;

/**
 * 管理员数据库操作
 */
public class AdminDaoImpl extends BaseDao implements AdminDao {
    @Override
    public int addUploadCount(int id) {
        String sql = "update admin set uploadCount = uploadCount + 1 where id = ?";
        return update(null, sql, id);
    }
    
    @Override
    public Admin queryById(int id) {
        String sql ="select * from admin where id = ?";
        return queryForOne(Admin.class, sql, id);
    }
    
    @Override
    public Admin queryByNameAndPassword(String name, String password) {
        String sql = "select * from admin where name = ? and password = ?";
        return queryForOne(Admin.class, sql, name, password);
    }
}
